{% extends "main.html" %}

{% load common %}

{% block title %}Repositories {{ repo }} {% endblock %}

{% block content_title %}Repository Information{% endblock %}

{% block breadcrumbs %}{{ block.super }} &rsaquo; <a href="{% url 'repo_list' %}">Repositories</a> &rsaquo; {{ repo }} {% endblock %}

{% block content %}

<div class="module">
    <h2>{{ repo }} Details</h2>
    <table>
        <tr><td>Name</td><td> {{ repo.name }} </td></tr>
        <tr><td>ID</td><td> {% if repo.repo_id != None %} {{ repo.repo_id }} {% endif %}</td></tr>
        <tr><td>Type</td><td> {{ repo.get_repotype_display }} </td></tr>
        <tr><td>Architecture</td><td> {{ repo.arch }} </td></tr>
        <tr><td>Security</td><td> {% yes_no_img repo.security 'False' 'Security' 'Not Security' %} </td></tr>
        <tr><td>Enabled</td><td> {% yes_no_img repo.enabled 'False' 'Enabled' 'Not Enabled' %} </td></tr>
        <tr><td>Mirrors</td><td> {{ repo.mirror_set.count }} </td></tr>
        <tr><td>Requires Authentication</td><td> {{ repo.auth_required }} </td></tr>
    </table>
</div>

{% if user.is_authenticated %}
    {% if perms.is_admin %}
    <div class="module">
        <h2>Actions</h2>
        <a class="brick" href="{% url 'repo_delete' repo.id %}">Delete this repository</a>
        {% if repo.enabled %}
          <a class="brick" href="{% url 'repo_disable' repo.id %}">Disable this repository</a>
        {% else %}
          <a class="brick" href="{% url 'repo_enable' repo.id %}">Enable this repository</a>
        {% endif %}
        {% if repo.security %}
          <a class="brick" href="{% url 'repo_disablesec' repo.id %}">Mark as Non-Security repo</a>
        {% else %}
          <a class="brick" href="{% url 'repo_enablesec' repo.id %}">Mark as Security repo</a>
        {% endif %}
        <a class="brick" href="{% url 'repo_edit' repo.id %}">Edit this repository</a>
        <div class="clearbrick"></div>
    </div>
    {% endif %}
{% endif %}
<div class="module">
  <h2>Mirrors</h2>
  {% gen_table repo.mirror_set.all %}
</div>
<div class="module">
  <h2>Hosts with this Repository</h2>
  {% gen_table repo.host_set.all.distinct %}
</div>
<div class="module">
  <h2>OS Groups with this Repository</h2>
  {% gen_table repo.osgroup_set.all.distinct %}
</div>
{% endblock %}

